package pt.mauromad.guias.bean;

import java.util.Set;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.NotBlank;

import pt.mauromad.guias.dao.security.RoleDao;

public class UserBean {
	private Long id;

	@NotNull
	@Pattern(regexp = "[a-z0-9\\.]{5,}")
	private String username;

	@Pattern(regexp = "\\w+")
	private String password;

	@NotNull
	@NotBlank
	private String firstName;

	@NotNull
	@NotBlank
	private String lastName;

	private Boolean enabled = true;

	private Set<RoleDao> roles;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public Boolean getEnabled() {
		return enabled;
	}

	public void setEnabled(Boolean enabled) {
		this.enabled = enabled;
	}

	public String getFullName() {
		return String.format("%s %s", firstName, lastName);
	}

	public Set<RoleDao> getRoles() {
		return roles;
	}

	public void setRoles(Set<RoleDao> roles) {
		this.roles = roles;
	}
}
